﻿
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YiMeiJiaLibModel.Business;
using YiMeiJiaLibModel.Business.Dto;
using YiMeiJiaLibModel.Config;
using YiMeiJiaLibModel.Enums;
using YiMeiJiaService.Assembly;
using YiMeiJiaService.IService;

namespace YiMeiJiaApp.Pages.Account.My
{
    public partial class Address
    {
        #region 服务组件

        [Inject] private IAcccount _account { get; set; }
        [Inject] private IGoods _goods { get; set; }

        [Inject] protected NavigationManager Navigation { get; set; }


        [Inject] protected IJSRuntime JSRuntime { get; set; }
        #endregion



        #region 绑定数据
        public List<CoreCmsUserShipDto> _address { get; set; }

        #endregion


        /// <summary>
        /// 加载事件
        /// </summary>
        /// <returns></returns>
        protected override async Task OnInitializedAsync()
        {

            try
            {
                 string msg = "all";
                var address = await _HttpClient.Action<List<CoreCmsUserShipDto>>("获取用户收货地址列表", new { }, true);
                if (address.status && address.data.Count > 0)
                {
                    _address = address.data; 
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            await base.OnInitializedAsync();
        }

        public Task SaveAddress()
        {
            // SaveUserShipPost
            return Task.CompletedTask;
        }
    }
}
